﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Jamhee.Noctiluca.Common
{
    public class LogUtil
    {
        public enum LogType
        {
            ERROR,
            INFO,
            WARNING
        };

        public static void LogTrace(LogType type, string message)
        {
            string typeMsg = null;
            switch (type)
            {
                case LogType.ERROR:
                    typeMsg = "E";
                    break;
                case LogType.INFO:
                    typeMsg = "I";
                    break;
                case LogType.WARNING:
                    typeMsg = "W";
                    break;
                default:
                    typeMsg = "I";     // Set INFO as default
                    break;
            }

            Console.WriteLine(typeMsg + DateTime.Now.ToString(" [yyyy-MM-dd HH:mm:ss] ") + message);
        }

        public static void PrintError(string error)
        {
            LogTrace(LogType.ERROR, error);
        }

        public static void PrintInfo(string info)
        {
            LogTrace(LogType.INFO, info);
        }

        public static void PrintWarning(string warning)
        {
            LogTrace(LogType.WARNING, warning);
        }
    }
}
